<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
        <!-- <script src="./a.js" defer></script> -->
        <style>
            div {
                text-align: center;
            }
        </style>
    </head>
    <body>
        <div>
            <span id="code"></span>
            <button onclick="randomStr()">看不清</button>
        </div>
    </body>
    <script>
        var span = document.querySelector("#code");
        var allstr =
            "0123456789abcdefghijklmnopqrstuvwxyzQWERTYUIOPASDFGHJKLZXCVBNM";
        function randomStr() {
            var numRandom = "";
            for (let i = 0; i < 4; i++) {
                var a = Math.floor(Math.random() * allstr.length);
                numRandom += allstr[a];
            }
            span.innerHTML = numRandom;
        }
        randomStr();
    </script>
</html>
